/*
 * @Author: PanZhangOne
 * @Date: 2017-12-17 11:41:18
 * @Last Modified by: PanZhangOne
 * @Last Modified time: 2017-12-17 12:01:37
 */

const TopicTag = require('../models/topicTag');

// 创建新tag
const createTopicTag = (name) => {
  if (!name) return Promise.reject('请输入tag name');
  return new Promise(async (resolve, reject) => {
    try {
      let tag = await TopicTag.create({
        name: name
      });

      resolve(tag);
    } catch (e) {
      reject(e);
    }
  });
};

module.exports = {
  createTopicTag
};
